﻿using ControlHelper.Attributes;
using Creator.Core.Base;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Creator.Core.Component
{
    /// <summary>
    /// 界面绘制组件基类，
    /// 初始化速度晚于常规组件
    /// </summary>
    public abstract class RenderComponent : IComponent, INotifyPropertyChanged
    {
        public RenderComponent(BaseObject baseObject) : base(baseObject)
        {
        }
        [Hide]
        public virtual bool AutoRender { get; set; } = false;
        [NickName("移动")]
        [Hide]
        public bool CanMove { get; set; } = true;
        [NickName("缩放")]
        [Hide]
        public bool CanWheel { get; set; } = true;

       [NickName("显示层级")]
        public int ZIndex { get; set; }

        public virtual void RaisePropertyChanged([CallerMemberName] string propertyName = null)
        {
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
